﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="author" content="Aowork">
    <meta name="description" content="">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no">

    <title></title>

    <link href="../css/mobile.css" rel="stylesheet" />

    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <script src="../js/zepto.min.js"></script>
    <script src="../js/zepto.swipe.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/config.js"></script>
    <script src="../js/uiExtend.js"></script>
    <script src="../js/wx_config.js"></script>

    <script type="text/javascript">
        jc.fnInit.push(function () {
            jc.ui.header.trigger("updateTitle", "用户注册");
            $('#pictureCaptcha').click(function(){
                $(this).attr("src", window.path.captcha + "?u=" + (jc.cookie.get("u") || "") + "&t=" + new Date().getTime())
            }).click();

        });
    </script>

    <script type="text/javascript">
        function checkPhone(phone) {
            if ((/^1[34578]\d{9}$/.test(phone))) {
                return true;
            }
        }
    </script>

    <script type="text/javascript">
        window.btnGroupClick = function (a) {
            jc.ui.form.trigger("confim", function (data) {

                if (!data) {
                    alert("亲！你是不是忘了填点什么东西了?");
                    return false;
                }

                if (!checkPhone(data.phoneNo)) {
                    alert("亲！手机号码格式不正确");
                    return false;
                }




                $.getJSON(window.path.verifyPhoneNo, {
                    phoneNo: data.phoneNo
                }, function (result) {
                    if (result.success) {
                        if (result.data) {
                            alert("亲![" + data.phoneNo + "]手机号已被注册");
                        }
                        else {
                            $.getJSON(window.path.validCode, data, function (result) {
                                if (result.success) {
                                    window.location.href = window.ctx + "register/register2.html#phoneNo=" + data.phoneNo + ";ticket=" + result.data.ticket;
                                }
                                else {
                                    alert(result.desc);
                                }
                            });
                        }
                    }
                });


       

            });

        }
    </script>

    <script type="text/javascript">
        var codeTimer = null;
        window.formBtnClick = function (a) {
            var $a = $(a);
            var second = 0;

            if ($a.hasClass("blue")) {
                jc.ui.form.trigger("getValue", "phoneNo", function (value) {
                    if (!value) {
                        alert("请先填写手机号");
                        return false;
                    }

                    if (!checkPhone(value)) {
                        alert("亲！手机号码格式不正确");
                        return false;
                    }

                    var pictureCaptcha = $('[data-id="pictureCaptcha"]').find('input').val()

                    if( !pictureCaptcha ){
                        alert('请填写图片验证码')
                        return false ;
                    }

                    if ($a.hasClass("blue")) {
                        $.getJSON(window.path.sendCode, { phoneNo: value,pictureCaptcha }, function (result) {

                            if (result.success) {

                                second = 59;
                                $a.html("重新发送(" + second + ")");
                                $a.attr("class", "abtn gray");

                                clearInterval(codeTimer);
                                codeTimer = setInterval(function () {
                                    second--
                                    if (second == 0) {
                                        clearInterval(codeTimer);
                                        $a.attr("class", "abtn blue");
                                        $a.html("获取验证码");
                                        $('#pictureCaptcha').click()
                                    }
                                    else {
                                        $a.html("重新发送(" + second + ")");
                                    }
                                }, 1000);
                            }
                            else {
                                alert(result.desc);
                            }
                        });

                    }
                    else {
                        $a.attr("class", "abtn blue");
                    }

                });
            }



        }
    </script>

    <script type="text/javascript">
        window.formInputBlur = function (input) {
            var $input = $(input);
            var value = $input.val();
            var id = $input.parents(".f_item").attr("data-id");

            if (id == "phoneNo") {
                if (!checkPhone(value)) {
                    alert("亲！手机号码格式不正确");
                }
                else {
                    $.getJSON(window.path.verifyPhoneNo, {
                        phoneNo: value
                    }, function (result) {
                        if (result.success) {
                            if (result.data) {
                                alert("亲![" + value + "]手机号已被注册");
                            }
                        }
                    });

                }
            }


        }
    </script>


</head>
<body>

    <div data-ui="header" class="J_header hideLogin">
        <div class="h_inner"></div>
    </div>

    <div data-ui="dotStep" class="J_dotStep mt14">
        <div class="d_item current"><a href="javascript:;">1</a></div>
        <div class="d_item"><a href="javascript:;">2</a></div>
    </div>

    <div data-ui="form" class="J_form">
        <div data-id="phoneNo" class="f_item">
            <div class="i_input">
                <input placeholder="请输入手机号" maxlength="11" type="tel">
            </div>
        </div>

        <div data-id="pictureCaptcha" class="f_item code clearfix">
            <div class="i_input">
                <input placeholder="请输入图片验证码" maxlength="6" type="text" />
            </div>
            <div class="i_btn">
                <a href="javascript:;">
                    <img id="pictureCaptcha" src="../tmp/get_img.jpg" style="width: 142px;height: 42px ;" />
                </a>
            </div>
        </div>

        <div data-id="code" class="f_item code clearfix">
            <div class="i_input">
                <input placeholder="请输入手机验证码" maxlength="6" type="tel" />
            </div>
            <div class="i_btn">
                <a class="abtn blue" href="javascript:;">获取验证码</a>
            </div>
        </div>


    </div>


    <div data-ui="btnGroup" class="J_btnGroup mt10 p10">
        <a class="abtn blue" href="javascript:;">提交</a>
    </div>







</body>
</html>
